<!DOCTYPE html>
<html>
<head>
    <title>请假详情</title>
    <meta charset="utf-8">
    <head th:include="weixin/include :: weixinheader"></head>
</head>
<body class="new-leave" ontouchstart>

    <div class="weui-panel weui-panel_access" th:object="${leave}">
        <div class="weui-cells__title">请假详情</div>
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <textarea class="weui-textarea" placeholder="请输入请假内容" rows="3" th:field="*{content}" readonly></textarea>
                </div>
            </div>
            <div class="line"></div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">开始时间</label></div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" th:field="*{startTime}" readonly>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">结束时间</label></div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" th:field="*{endTime}" readonly>
                </div>
            </div>
            <div class="line"></div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">审批人</label></div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" th:field="*{teacher.name}" readonly>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">审批结果</label></div>
                <div class="weui-cell__bd">
					<span class="in-check" th:if="*{status eq '0'}">待审核</span>
					<span class="in-agree" th:if="*{status eq '1'}">已同意</span>
					<span class="in-agree" th:if="*{status eq '2'}">驳回</span>
                </div>
            </div>
            <div class="demos-content-padded" align="center" th:if="*{status eq '0'}">
		        <a href="javascript:;" onclick="update('1')" class="weui-btn weui-btn weui-btn_primary">同意</a>
		        <a href="javascript:;" onclick="update('2')" class="weui-btn weui-btn weui-btn_warn">驳回</a>
	      	</div>
        </div>

    </div>

<div th:include="weixin/include :: weixinfooter"></div>

<script type="text/javascript">
	var prefix = ctx + "module/leave"
	var leaveId = [[${leave.leaveId}]];
	function update(status){
		var data = {
			"status":status,
			"leaveId":leaveId
		};
		$.post("updateStatus",data,function(data){
			if(data.code == "0"){
				location.href= "leaveListByTeacher";
			}
		});
	}
</script>
</body>

</html>
